<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.pay.sdk.*"%>
<%@ page import="com.pay.sdk.service.channel1.*"%>
<%
	// [重要]该页面仅为示例页面，在正式使用时，应当先对传入参数进行安全性检查和过滤，防止XSS等攻击。SDK中的方法没有对传入的参数进行任何检查和过滤。
	
	String type = request.getParameter("redirect_type");
	
	if("ep_auth".equals(type)) {// Ex.1-1 快捷支付认证跳转
	
		String trac_no = new String(request.getParameter("trac_no").getBytes("ISO-8859-1"), "UTF-8");
		String acct_type = new String(request.getParameter("acct_type").getBytes("ISO-8859-1"), "UTF-8");
		String bank_no = new String(request.getParameter("bank_no").getBytes("ISO-8859-1"), "UTF-8");
		String card_no = new String(request.getParameter("card_no").getBytes("ISO-8859-1"), "UTF-8");
		// 【重要】出于安全考虑，在调用函数前，需要对上面的参数进行防护过滤等操作
		out.println(ChannelOnePay.epAuth(trac_no, acct_type, bank_no, card_no));
	} else if("ep_authpay".equals(type)) { 		// Ex.1-9 无绑定账户的快捷支付接口
		String order_no = new String(request.getParameter("order_no").getBytes("ISO-8859-1"), "UTF-8");
		String order_time = new String(request.getParameter("order_time").getBytes("ISO-8859-1"), "UTF-8");
		String order_amount = new String(request.getParameter("order_amount").getBytes("ISO-8859-1"), "UTF-8");
		String order_title = new String(request.getParameter("order_title").getBytes("ISO-8859-1"), "UTF-8");
		String order_desc = new String(request.getParameter("order_desc").getBytes("ISO-8859-1"), "UTF-8");
		String remote_ip = new String(request.getParameter("order_ip").getBytes("ISO-8859-1"), "UTF-8");;
		// 【重要】出于安全考虑，在调用函数前，需要对上面的参数进行防护过滤等操作
		out.println(ChannelOnePay.epAuthPay(order_no, order_time, order_amount, order_title, order_desc, remote_ip));
	} else if("ep_query".equals(type)) { 		// 查询
		String order_no = new String(request.getParameter("order_no").getBytes("ISO-8859-1"), "UTF-8");
		String order_date = new String(request.getParameter("order_date").getBytes("ISO-8859-1"), "UTF-8");
		out.println(ChannelOnePay.epQuery(order_no, order_date));
	}else if("ep_auth_sny".equals(type)) { 		//快捷认证同步接口
		String trac_no = new String(request.getParameter("trac_no").getBytes("ISO-8859-1"), "UTF-8");
		String acct_type = new String(request.getParameter("acct_type").getBytes("ISO-8859-1"), "UTF-8");
		String card_no = new String(request.getParameter("card_no").getBytes("ISO-8859-1"), "UTF-8");
		String user_name = new String(request.getParameter("user_name").getBytes("ISO-8859-1"), "UTF-8");
		String cert_no = new String(request.getParameter("cert_no").getBytes("ISO-8859-1"), "UTF-8");
		String card_phone = new String(request.getParameter("card_phone").getBytes("ISO-8859-1"), "UTF-8");
		String bank_no = new String(request.getParameter("bank_no").getBytes("ISO-8859-1"), "UTF-8");
		String expireDate = new String(request.getParameter("expireDate").getBytes("ISO-8859-1"), "UTF-8");
		String cvn = new String(request.getParameter("cvn").getBytes("ISO-8859-1"), "UTF-8");
		out.println(ChannelOnePay.epAuthSyncWithSms(trac_no, acct_type, bank_no, card_no, user_name, cert_no, card_phone, expireDate, cvn));
	}else if("check_sms".equals(type)){
		String trac_no = new String(request.getParameter("trac_no").getBytes("ISO-8859-1"), "UTF-8");
		String sms_code = new String(request.getParameter("sms_code").getBytes("ISO-8859-1"), "UTF-8");
		out.println(ChannelOnePay.epAuthCheckSms(trac_no, sms_code));
	}else if("ep_pay".equals(type)){//快捷支付借口
		String order_no = new String(request.getParameter("order_no").getBytes("ISO-8859-1"), "UTF-8");
		String order_amount = new String(request.getParameter("order_amount").getBytes("ISO-8859-1"), "UTF-8");
		String order_title = new String(request.getParameter("order_title").getBytes("ISO-8859-1"), "UTF-8");
		String order_desc = new String(request.getParameter("order_desc").getBytes("ISO-8859-1"), "UTF-8");
		String card_no = new String(request.getParameter("card_no").getBytes("ISO-8859-1"), "UTF-8");
		String order_time = new String(request.getParameter("order_time").getBytes("ISO-8859-1"), "UTF-8");
		String cur = new String(request.getParameter("cur").getBytes("ISO-8859-1"), "UTF-8");
		out.println(ChannelOnePay.epPay(order_no, order_amount, order_title, order_desc, card_no, order_time, cur));
	}else if("ep_auth_cancel".equals(type)){
		String card_no = new String(request.getParameter("card_no").getBytes("ISO-8859-1"), "UTF-8");
		out.println(ChannelOnePay.epAuthCancel(card_no));
	}else if("ep_auth_query".equals(type)){//认证查询
		String trac_no = new String(request.getParameter("trac_no").getBytes("ISO-8859-1"), "UTF-8");
		out.println(ChannelOnePay.epAuthQuery(trac_no));
	}
%>